﻿using System.ComponentModel.DataAnnotations;
using static Modules.Person.PersonConstants;

namespace ManagementApi.Models.Cms;

public class PrjPersonInfoResult
{
    /// <summary>
    /// 岗位名称枚举(0开头为监理岗位,1开头的为施工员岗位,2开头的安全员岗位)
    /// </summary>
    [Display(Name = "岗位名称")]
    [Required(ErrorMessage = "{0}不能为空")]
    public string GWName { get; set; }

    //       /// 监理项目负责人 = 000,//管理层
    //总监理工程师 = 001,
    //总监理工程师代表 = 002,
    //专业监理工程师 = 003,
    //监理员 = 004,
    //其他监理员 = 009

    //施工项目负责人 = 100, //管理层
    //施工员 = 101,
    //质量员 = 102,
    //标准员 = 103,
    //材料员 = 104,
    //机械员 = 105,
    //劳务员 = 106,
    //资料员 = 107,
    //其他施工岗位 = 109,

    //安全主要负责人 = 201,
    //安全项目负责人 = 202,
    //安全员 = 203,

    /// <summary>
    /// 姓名
    /// </summary>
    [Display(Name = "姓名")]
    [Required(ErrorMessage = "{0}不能为空")]
    public string GRName { get; set; }

    /// <summary>
    ///  身份证号
    /// </summary>
    [Display(Name = "身份证号")]
    [Required(ErrorMessage = "{0}不能为空")]
    public string GRIDCard { get; set; }

    /// <summary>
    /// 学历
    /// </summary>
    [Display(Name = "学历")]
    public string? GRWhcd { get; set; }

    /// <summary>
    /// 合同有效期起
    /// </summary>
    [Display(Name = "合同有效期起")]
    public string? ContractStartDate { get; set; }

    /// <summary>
    /// 合同有效期止
    /// </summary>
    [Display(Name = "合同有效期止")]
    public string? ContractEndDate { get; set; }

    /// <summary>
    /// 身份证照片Base64
    /// </summary>
    [Display(Name = "身份证照片Base64")]
    [Required(ErrorMessage = "{0}不能为空")]
    public string GRPhoto { get; set; }

    /// <summary>
    /// 模板照片Base64(核验照片)
    /// </summary>
    [Display(Name = "模板照片Base64")]
    public string? GRTemplatePhoto { get; set; }
    /// <summary>
    /// 性别
    ///</summary>
    [Display(Name = "性别")]
    public int? Gender { get; set; }
    /// <summary>
    /// 出生日期
    ///</summary>
    [Display(Name = "出生日期")]
    public DateTime? Birthday { get; set; }
    /// <summary>
    /// 创建日期
    ///</summary>
    [Display(Name = "创建日期")]
    [Required(ErrorMessage = "{0}不能为空")]
    public DateTime CreateTime { get; set; }


}
public static partial class PrjPersonInfoResultExceptions {
    /// <summary>
    /// 将管理岗位名称转换成枚举
    /// </summary>
    /// <param name="gRName"></param>
    /// <returns></returns>
    public static 管理岗位类型 AsPostCategory(this string gRName) {
        管理岗位类型 postCategory = 0;
        switch (gRName) {
            case "项目负责人":
                postCategory = 管理岗位类型.项目经理;
                break;
            case "安全员":
                postCategory = 管理岗位类型.安全员;
                break;
            case "技术负责人":
                postCategory = 管理岗位类型.技术负责人;
                break;
            case "总监理工程师":
                postCategory = 管理岗位类型.总监理工程师;
                break;
            case "总监理工程师代表":
                postCategory = 管理岗位类型.总监理工程师代表;
                break;
            default:
                break;
        }
        return postCategory;
    }
}